package Models;

import java.util.Calendar;
import java.util.Date;

/**
 * @author Morten
 */
public class Item
{
	private static int nextId = 100;
	private int itemNo;
	private String name, description, manufacturer;
	private Supplier supplier;
	private double price;
	private int amount;
	private Date acquisitionDate;
	private Location location;
	private int minimumStock, maximumStock;
	private boolean activated = true;

	public Item(String name, String description, String manufacturer, Supplier supplier, double price, Location location, int minimumStock, int maximumStock)
	{
        Date today = Calendar.getInstance().getTime();
		this.edit(name, description, manufacturer, supplier, price, today, location, minimumStock, maximumStock);
        this.itemNo = Item.nextId;
		Item.nextId++;
	}

	public void edit(String name, String description, String manufacturer, Supplier supplier, double price, Date acquisitionDate, Location location, int minimumStock, int maximumStock)
	{
		this.setName(name);
		this.setDescription(description);
		this.setManufacturer(manufacturer);
		this.setSupplier(supplier);
		this.setPrice(price);
		this.setAcquisitionDate(acquisitionDate);
		this.setLocation(location);
		this.setMinimumStock(minimumStock);
		this.setMaximumStock(maximumStock);
	}

	public void takeOne()
	{
		this.amount--;
		//TODO: Tjek om amount er under minimum, i så fald order!
	}

	public Date getAcquisitionDate()
	{
		return acquisitionDate;
	}

	public int getAmount()
	{
		return amount;
	}

	public String getDescription()
	{
		return description;
	}

	public int getItemNo()
	{
		return itemNo;
	}

	public Location getLocation()
	{
		return location;
	}

	public String getManufacturer()
	{
		return manufacturer;
	}

	public Supplier getSupplier()
	{
		return supplier;
	}

	public int getMaximumStock()
	{
		return maximumStock;
	}

	public int getMinimumStock()
	{
		return minimumStock;
	}

	public String getName()
	{
		return name;
	}

	public double getPrice()
	{
		return price;
	}

	public boolean isActivated()
	{
		return activated;
	}

	public void setActivated(boolean activated)
	{
		this.activated = activated;
	}

	public void setAcquisitionDate(Date acquisitionDate)
	{
		this.acquisitionDate = acquisitionDate;
	}

	public void setAmount(int amount)
	{
		this.amount = amount;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	public void setLocation(Location location)
	{
		this.location = location;
	}

	public void setManufacturer(String manufacturer)
	{
		this.manufacturer = manufacturer;
	}

	public void setSupplier(Supplier supplier)
	{
		this.supplier = supplier;
	}

	public void setMaximumStock(int maximumStock)
	{
		this.maximumStock = maximumStock;
	}

	public void setMinimumStock(int minimumStock)
	{
		this.minimumStock = minimumStock;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public void setPrice(double price)
	{
		this.price = price;
	}
}